package com.rabbiter.oes.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.rabbiter.oes.entity.College;
import org.apache.ibatis.annotations.*;

@Mapper
public interface CollegeMapper {
    @Select("select * from college")
    IPage<College> findAll(Page page);

    @Select("SELECT * FROM college where id=#{id}")
    College selectCollegeById(int id);

    @Update("UPDATE college set name=#{name},established=#{established},num_students=#{numStudents},num_faculty=#{numFaculty},introduction=#{introduction} Where id=#{id}")
    int updateCollege(College college);

    @Delete("DELETE FROM college where  id=#{id}")
    int deleteCollege(int id);

    @Insert("INSERT INTO college values (null,#{name},#{established},#{numStudents},#{numFaculty},#{introduction})")
    int addCollege(College college);
}
